<template>
<div>
  <home-header></home-header>
  <home-swiper :swiperData="swiperData"></home-swiper>
  <home-icons :iconsData="iconsData"></home-icons>
  <home-recommend :recommendData="recommendData"></home-recommend>
  <home-weekend :weekendData="weekendData"></home-weekend>
</div>
</template>

<script>
import HomeHeader from './components/Header.vue'
import HomeSwiper from './components/Swiper.vue'
import HomeIcons from './components/Icons.vue'
import HomeRecommend from './components/Recommend.vue'
import HomeWeekend from './components/Weekend.vue'
import axios from 'axios'
export default {
  name: 'Home',
  data: function () {
    return {
      swiperData: [],
      iconsData: [],
      recommendData: [],
      weekendData: []
    }
  },
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeekend

  },
  methods: {
    getHomeInfo: function () {
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      this.swiperData = res.swiperList
      this.iconsData = res.iconList
      this.recommendData = res.recommendList
      this.weekendData = res.weekendList
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style scoped>

</style>
